package com.elastic.demo;

import com.elastic.chain.Leader;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.Operator;
import org.elasticsearch.index.query.QueryBuilders;

/**
 * @ClassName InsignificanceLeader
 * @Author xiezhuocai
 * @Description 测试类
 * @Date 2021/12/23 0:06
 */
public class InsignificanceLeader extends Leader {

    @Override
    public boolean handleRequest(BoolQueryBuilder boolQuery, String key, Object value) {
        if (key.equals("userName")) {
            boolQuery.must(QueryBuilders.matchQuery(key, value).operator(Operator.AND));
            return true;
        }
        return false;
    }
}
